package com.tfy.liquor.dao;

import com.tfy.liquor.bean.SystemConfiguration;
import com.tfy.liquor.bean.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Mapper
@Service
public interface SystemConfigurationDao {
    // 添加信息
    @Insert("insert into system_configuration values (null, '${title}', '${value}', '${remark}', ${status}, '${createTime}')")
    int addSystemConfiguration(SystemConfiguration systemConfiguration);

    // 根据id获取信息
    @Select("select * from system_configuration where id=${id} and status=0")
    SystemConfiguration getSystemConfigurationById(Integer id);

    // 根据title获取信息
    @Select("select * from system_configuration where title='${title}' and status=0")
    SystemConfiguration getSystemConfigurationByTitle(String title);

    // 修改使用状态
    @Update("update system_configuration set status=${status} where id=${id}")
    int editSystemConfigurationStatus(SystemConfiguration systemConfiguration);

    // 获取系统设置信息
    @Select("select * from system_configuration order by id desc")
    ArrayList<SystemConfiguration> getSystemConfiguration();
}
